package io.jnet.server.serverchannelcontext;

import java.nio.channels.AsynchronousSocketChannel;
import io.jnet.common.api.ReadHandler;
import io.jnet.common.api.impl.SimpleReadHandler;
import io.jnet.common.bufstorage.BufStorage;
import io.jnet.common.decodec.FrameDecodec;
import io.jnet.common.streamprocessor.StreamProcessor;
import io.jnet.common.util.AioListener;

public class SimpleServerChannelContext extends AbstractServerChannelContext
{
    private final ReadHandler readHandler;
    
    public SimpleServerChannelContext(//
            BufStorage bufStorage, //
            int maxMerge, //
            AioListener serverListener, //
            StreamProcessor[] processors, //
            AsynchronousSocketChannel socketChannel, //
            FrameDecodec frameDecodec)
    {
        super(bufStorage, maxMerge, serverListener, processors, socketChannel, frameDecodec);
        readHandler = new SimpleReadHandler(writeHandler, processors, socketChannel, bufStorage, frameDecodec, ioBuf, serverListener, this);
    }
    
    @Override
    public void registerRead()
    {
        readHandler.registerRead();
    }
    
}
